package com.logic.modular.game.player.bag.service;


import com.comment.pojo.domain.bag.BagItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * 背包物品服务---坐骑
 */
@Slf4j
@Service

public class PlayerPropType5ServiceImpl {
    @Resource
    private BagItemServiceImpl bagItemService;

    /**
     * 装备 坐骑
     *
     * @param playerId  玩家id
     * @param bagItemId 背包单元格id
     * @return 是否成功
     */
    public boolean tryEquipMount(Long playerId, Long bagItemId, Long playerHeroId) {
        BagItem bagItem = bagItemService.obtainPlayerBagItemHandlerPower(playerId, bagItemId);
        bagItem.setPropStatus(1);
        HashMap<String, Object> useInfo = new HashMap<>();
        useInfo.put("playerHeroId", playerHeroId);
        useInfo.put("equipSlot", 2);
        bagItem.extend.put("useInfo", useInfo);
        bagItem.setStatus(1);
        return bagItemService.updateById(bagItem);
    }
}
